package lanQiaoBei.testQuestions.编程题;

import java.util.Arrays;
import java.util.Scanner;

public class _01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] datas = new int[n];
        int[] temp = new int[n];
        for (int i = 0; i < n; i++) {
            datas[i] = scanner.nextInt();
        }
        // 复制数组
        System.arraycopy(datas, 0, temp, 0, datas.length);
        // 排序数组
        Arrays.sort(temp);
        int midIndex=temp.length/2;
        int midValue=temp[midIndex];

        int equalLeft=0;
        int equalRight=0;
        for(int i=midIndex,j=midIndex;i>0||j<temp.length;i--,j++){
            if(temp[i]==midValue){
                equalLeft+=1;
            }
            if(temp[j]==midValue){
                equalRight+=1;
            }
            if(temp[i]!=temp[j])break;
        }
        int case1=0;
        int case2=0;
        if(equalLeft>=equalRight&&(temp.length%2==1)){
            case1=1;
        }
        if(equalLeft>equalRight){
            case2=1;
        }
        for (int i = 0; i < datas.length; i++) {
            int count=0;
            if(datas[i]==midValue){
                count=case2;
            }else {
                count=midValue-datas[i]+case1;
                if(count<0)count=0;
            }
            System.out.print(count+" ");
        }
    }
}
